<?php
namespace app\api\controller;

use app\api\model\GameModel;
use think\Controller;
class Game extends Controller
{
    function gamedetail() {
        $gameid = input('get.gameid');
        $model = new GameModel();
        $result = $model->gamedetail($gameid);
        return json($result);
    }

    function gamelist() {
        $model = new GameModel();
        $result = $model->gamelist();
        return json($result);
    }

    function gameenroll() {
        $gameid = input('gameid');
        $userid = input('userid');
        $model = new GameModel();
        $result = $model->gameenroll($gameid,$userid);
        return json($result);
    }
    
    function collect() {
        $userid = (int)input('get.userid');
        $gameid = (int)input('get.gameid');

        $model = new GameModel();
        $result = $model->collect($userid, $gameid);
        return json($result);
    }

    function isCollect() {
        $userid = input('get.userid');
        $gameid = input('get.gameid');

        $model = new GameModel();
        $result = $model->isCollect($userid, $gameid);
        return json($result);
    }

    public function collectGameList(){
        $userid = input('get.userid');
        $model = new GameModel();
        $result = $model->collectGameList($userid);
        return json($result);
    }
}